<template>
	<view class="ca-page">
		<button class="btn-pay" @click="bindPay">我要支付</button>
		<!-- 弹框 -->
		<uni-popup ref="popupPaypwd" type="share">
			<paypwd></paypwd>
		</uni-popup>
	</view>
</template>

<script>
	import uniTransition from '../../uni_modules/uni-transition/components/uni-transition/uni-transition.vue';
	import uniPopup from '../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue';
	import paypwd from '../../components/paypwd.vue';
	
	const APP = getApp();
	const E_PAY = 'pay_over';
	
	export default {		
		data() {
			return {
				
			};
		},
		components:{
			uniTransition,uniPopup,paypwd
		},
		methods:{
			bindPay(e){
				this.$refs.popupPaypwd.open();
			}
		},
		onLoad(options) {
			//设置监听
			uni.$on(E_PAY,function(param){
				uni.showToast({
					title:'支付密码：'+param.pwd
				})
				//执行完成(重置密码)
				uni.$emit('reset_paypwd',{});
			});
		},
		onUnload() {
			//注销监听
			uni.$off(E_PAY);
		}
	}
</script>

<style lang="scss">
	.btn-pay{
		margin: 50rpx; background-color: #007AFF; color:#FFFFFF; font-size:30rpx;
	}
</style>
